package thread;

public class Bank {
    private int account=2000000;
    public synchronized boolean getMoney(int money){
        int account=getAccount();
        if(account>=money){
            account = account-money;
            Thread.yield();
            saveAccount(account);
            return true;
        }
            return false;
    }
    public void saveAccount(int account){
        this.account=account;
    }
    public int getAccount(){
        return account;
    }



}
